Questions

  • Which types / classes have unwanted dependencies in our code?
  • Which group of types / classes is highly cohesive but lowly coupled?

Idea

Using JDK's jdeps command line utility, we can extract the existing dependencies between Java types:

jdeps -v dropover-classes.jar > jdeps.txt

Data

Read data in with Open Zippy Analysis Platform For Data In Software


In [1]:
from ozapfdis import jdeps

deps = jdeps.read_jdeps_file(
    "../datasets/jdeps_dropover.txt",
    filter_regex="at.dropover")
deps.head()


Out[1]:
raw from to type
0 at.dropover.comment.boundary.AddCommentRequ... at.dropover.comment.boundary.AddCommentRequest... at.dropover.framework.boundary.SiteDependentRe... dropover
1 at.dropover.comment.boundary.ChangeCommentR... at.dropover.comment.boundary.ChangeCommentRequ... at.dropover.framework.boundary.SiteDependentRe... dropover
2 at.dropover.comment.boundary.CommentData ... at.dropover.comment.boundary.CommentData at.dropover.comment.boundary.TimeDiffResponseM... dropover
3 at.dropover.comment.boundary.CommentData ... at.dropover.comment.boundary.CommentData at.dropover.framework.boundary.ResponseModel dropover
4 at.dropover.comment.boundary.GetCommentRequ... at.dropover.comment.boundary.GetCommentRequest... at.dropover.framework.boundary.SiteDependentRe... dropover

Modeling

Extract the information about existing modules based on path naming conventions


In [2]:
deps = deps[['from', 'to']]
deps['group_from'] = deps['from'].str.split(".").str[2]
deps['group_to'] = deps['to'].str.split(".").str[2]
deps.head()


Out[2]:
from to group_from group_to
0 at.dropover.comment.boundary.AddCommentRequest... at.dropover.framework.boundary.SiteDependentRe... comment framework
1 at.dropover.comment.boundary.ChangeCommentRequ... at.dropover.framework.boundary.SiteDependentRe... comment framework
2 at.dropover.comment.boundary.CommentData at.dropover.comment.boundary.TimeDiffResponseM... comment comment
3 at.dropover.comment.boundary.CommentData at.dropover.framework.boundary.ResponseModel comment framework
4 at.dropover.comment.boundary.GetCommentRequest... at.dropover.framework.boundary.SiteDependentRe... comment framework

Visualization

Output results with An Unified Software Integrator


In [3]:
from ausi import d3

d3.create_d3force(
    deps,
    "jdeps_demo_output/dropover_d3forced",
    group_col_from="group_from",
    group_col_to="group_to")


JSON file produced in 'C:\dev\repos\software-analytics\courses\20190918_Uni_Leipzig\jdeps_demo_output\dropover_d3forced.json'
HTML file produced in 'C:\dev\repos\software-analytics\courses\20190918_Uni_Leipzig\jdeps_demo_output\dropover_d3forced.html'

In [4]:
d3.create_semantic_substrate(
    deps,
    "jdeps_demo_output/dropover_semantic_substrate")


JSON file produced in 'C:\dev\repos\software-analytics\courses\20190918_Uni_Leipzig\jdeps_demo_output\dropover_semantic_substrate.json'
HTML file produced in 'C:\dev\repos\software-analytics\courses\20190918_Uni_Leipzig\jdeps_demo_output\dropover_semantic_substrate.html'

In [5]:
d3.create_hierarchical_edge_bundling(
    deps,
    "jdeps_demo_output/dropover_bundling")


JSON file produced in 'C:\dev\repos\software-analytics\courses\20190918_Uni_Leipzig\jdeps_demo_output\dropover_bundling.json'
HTML file produced in 'C:\dev\repos\software-analytics\courses\20190918_Uni_Leipzig\jdeps_demo_output\dropover_bundling.html'